package com.bw.dws;

import org.apache.flink.table.annotation.DataTypeHint;
import org.apache.flink.table.annotation.FunctionHint;
import org.apache.flink.table.functions.TableFunction;
import org.apache.flink.types.Row;

import java.util.Set;

// 一进多出

/**
 *  洗碗机
 *
 *   洗碗机         洗       1
 *   洗碗机        碗机
 */
@FunctionHint(output = @DataTypeHint("row<keyword string>"))
public class KwSplit extends TableFunction<Row> {
    public void eval(String kw){
        Set<String> words = IkUtil.split(kw);
        for (String word : words) {
            collect(Row.of(word));
        }
    }
}
